package ca.llsutherland.squash;

import junit.framework.TestCase;
import ca.llsutherland.squash.domain.Clock;
import ca.llsutherland.squash.domain.DomainObject;
import ca.llsutherland.squash.domain.NamedDomainObject;

public class BaseValidator extends TestCase{

    protected static void assertValidDomainObject(String message, DomainObject actual) {
        assertNotNull("Actual domain object should not be null", actual);
        assertNotNull("Actual domain object id should not be null", actual.getId());
    }

    protected static void assertValidNamedDomainObject(String message, NamedDomainObject expected, NamedDomainObject actual) {
        assertEquals(message, expected.getName(), actual.getName());
        assertClock("Created dates should be the same ", expected.getDateCreated(), actual.getDateCreated());
        assertClock("Updated dates should be the same ", expected.getDateUpdated(), actual.getDateUpdated());
    }

    protected static void assertClock(String message, Clock expected, Clock actual) {
        assertEquals(message, expected, actual);
    }
}
